@extends('layouts.layouts')
@section('content')
        <!--面包屑配置项 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{{ url('Admin/info') }}">首页</a> &raquo;修改配置项
</div>
<!--面包屑配置项 结束-->

<!--结果集标题与配置项组件 开始-->
<div class="result_wrap">
    <div class="result_title">
        <h3>修改配置项</h3>
        @if(count($errors)>0)
            <div class="mark">
                @foreach($errors->all() as $error)
                    <p>{{ $error }}</p>
                @endforeach
            </div>
        @endif
        @if(session('info'))
            <div class="mark">
                <p>{{ session('info') }}</p>
            </div>
        @endif
    </div>
    <div class="result_content">
        <div class="short_wrap">
            <a href="{{ url('Admin/conf/create') }}"><i class="fa fa-plus"></i>添加配置项</a>
            <a href="{{ url('Admin/conf') }}"><i class="fa fa-recycle"></i>配置项列表</a>
        </div>
    </div>
</div>
<!--结果集标题与配置项组件 结束-->

<div class="result_wrap">
    <form action="{{ url('Admin/conf/'.$data->conf_id) }}" method="post">
        {{ csrf_field() }}
        <input type="hidden" name="_method" value="put">
        <table class="add_tab">
            <tbody>
            <tr>
                <th><i class="require">*</i>配置项名称：</th>
                <td>
                    <input type="text" name="conf_name" value="{{ $data->conf_name }}">
                    <span><i class="fa fa-exclamation-circle yellow"></i>配置项名称必须填写</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>配置项标题：</th>
                <td>
                    <input type="text" name="conf_title" value="{{ $data->conf_title }}">
                    <span><i class="fa fa-exclamation-circle yellow"></i>配置项标题必须填写</span>
                </td>
            </tr>
            <tr>
                <th>配置项类型：</th>
                <td>
                    <input type="radio" class="sm" name="conf_type" value="input"
                           @if($data->conf_type == 'input')
                           checked
                           @endif
                           onclick="showTr()">input &nbsp;
                    <input type="radio" class="sm" name="conf_type" value="textarea"
                           @if($data->conf_type == 'textarea')
                           checked
                           @endif
                           onclick="showTr()">textarea &nbsp;
                    <input type="radio" class="sm" name="conf_type" value="radio"
                           @if($data->conf_type == 'radio')
                           checked
                           @endif
                           onclick="showTr()">radio &nbsp;
                </td>
            </tr>
            <tr class="conf_value">
                <th>配置项类型值：</th>
                <td>
                    <input type="text" class="lg" name="conf_value" value="{{ $data->conf_value }}">
                    <p><i class="fa fa-exclamation-circle yellow"></i>类型值只有在radio的情况下才需要配置，格式1|开启，0|关闭</p>
                </td>
            </tr>
            <tr>
                <th>排序：</th>
                <td>
                    <input type="text" class="sm" name="conf_order" value="{{ $data->conf_order }}">
                </td>
            </tr>
            <tr>
                <th>说明：</th>
                <td>
                    <textarea name="conf_tips">{{ $data->conf_tips }}</textarea>
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input type="submit" value="提交">
                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<script type="text/javascript">
    showTr();
    function showTr()
    {
        var type = $("input[name=conf_type]:checked").val();
        if(type == 'radio')
        {
            $('.conf_value').show();
        }else
        {
            $('.conf_value').hide();
            $("input[name=conf_value]").val('');
        }
    }
</script>
@endsection